package com.hll.spring_book.config;

import com.hll.spring_book.aop.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: Mr.Hu
 * @create: 2021-03-30 10:59
 */
@Configuration
public class IntercepterConfig implements WebMvcConfigurer {
  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry
        .addInterceptor(new LoginInterceptor())
        .addPathPatterns("/**")
        .excludePathPatterns(
            "/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
    WebMvcConfigurer.super.addInterceptors(registry);
  }
}
